/*
 * @Description: 存储授权相关方法
 * @Author: Rfan
 * @Date: 2022-03-28 15:25:29
 * @LastEditTime: 2022-04-01 13:24:03
 */

const TokenKey = 'token';
const NameKey = 'realName';
const UserKey = 'userInfo';

export function getToken() {
  return localStorage.getItem(TokenKey);
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, token);
}

export function removeToken() {
  return localStorage.removeItem(TokenKey);
}

export function getRealName() {
  return localStorage.getItem(NameKey);
}

export function setRealName(name) {
  return localStorage.setItem(NameKey, name);
}

export function removeRealName() {
  return localStorage.removeItem(NameKey);
}

export function setUser(user) {
  return localStorage.setItem(UserKey, JSON.stringify(user));
}

export function getUser() {
  return JSON.parse(localStorage.getItem(UserKey) || '{}');
}

export function removeUser() {
  return localStorage.removeItem(NameKey);
}
